// 算法
class TestStack {
  constructor() {
    this.stackData = [];
    this.stackMinus = [];
  }


  push(newNum) {
    this.stackData.push(newNum);

    if (this.stackMinus.length == 0) {
      this.stackMinus.push(newNum);
    } else {
      const value = this.getMinimus();
    }
  }

  getMinimus() {
    if (this.stackMinus.length > 0) {
      return this.stackMinus[this.stackMinus.length - 1];
    }
    throw (new Error(-1, 'this.stackMins is empty'));
  }

  getItems() {
    return this.stackData;
  }
}

const b = new TestStack();
b.push(1);
b.push(2);

// print(b.getItems());
console.log(`result = ${b.getItems()}`);
// (b.getItems());
